import pandas as pd
import matplotlib.pyplot as plt

# 读取四个CSV文件
data1 = pd.read_csv(r'C:\Downloads\pure.csv')
data2 = pd.read_csv(r'C:\Downloads\finetune.csv')
data3 = pd.read_csv(r'C:\Downloads\mix.csv')
data4 = pd.read_csv(r'C:\Downloads\pretrain_200.csv')

# 将数据整理为需要的格式
x1 = data1['Step']
y1 = data1['Value']

x2 = data2['Step']
y2 = data2['Value']

x3 = data3['Step']
y3 = data3['Value']

x4 = data4['Step']
y4 = data4['Value']

# 创建一个新的图形
plt.figure()

# 画出四条线
plt.plot(x1, y1, label='pure')
plt.plot(x2, y2, label='finetune')
plt.plot(x3, y3, label='mix')
plt.plot(x4, y4, label='pretrain')

# 设置图形的标题和坐标轴标签
# plt.title('Comparison of four different method ofof training')
plt.xlabel('Epoch')
plt.ylabel('Validation Error')

# 显示图例
plt.legend()

# 显示图形
plt.show()